package week9;


import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main3{
	public static void main(String[] args){
		Set<String> words=new TreeSet<>();
		Scanner sc = new Scanner(System.in);
		
		while(true){
			String s=sc.next();
			if(s.equals("!!!!!"))
				break;
			words.add(s);
			
		}
		System.out.println(words.size());
		int i=1;
		for(String e:words){
			if(i++>10)
				break;
			else
				System.out.println(e);
		}
		sc.close();
	}
}
